package com.jourwon.spring.boot.controller;

import com.alibaba.fastjson.JSON;
import com.jourwon.spring.boot.util.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author JourWon
 * @date 2022/4/21
 */
@Api(tags = "Redis测试")
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Resource
    private RedisUtils redisUtils;

    @GetMapping("/dict}")
    @ApiOperation("获取字典值")
    public String get() {
        Map<String, String> stringStringMap = redisUtils.hEntries("DICT");
        return JSON.toJSONString(stringStringMap);
    }

}
